<template>
<!-- 操作记录 -->
  <div class="box">
    <a-table
      bordered
      :columns="state.columns"
      :data-source="state.opreateList"
    >
    </a-table>
  </div>
</template>



<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue';
import { moduleRunApi } from "@/api/devcloudApi";

export default defineComponent({
  name: 'opreate',
  components: {
  },
  props: {
    moduleId: {
      type: Number,
      required: false,
    },
  },
  setup(props) {
    const { moduleId } = toRefs(props);

    const state = reactive({
      opreateList: [],
      query: {
        currentPage: 1,
        pageSize: 10,
        moduleId: moduleId.value,
      },
      columns: [
        {
          title: "运行时间",
          dataIndex: "createTime",
          key: "createTime",
          width: 180,
        },
        {
          title: "镜像名称",
          dataIndex: "imageName",
          key: "imageName",
          width: 420,
        },
        {
          title: "运行人",
          dataIndex: "createrName",
          key: "createrName",
          width: 120,
        },
        {
          title: "操作",
          dataIndex: "operation",
          key: "operation",
          width: 120,
        }
      ]
    })

    const page = async () => {
      state.query.moduleId = moduleId.value;
      const res = await moduleRunApi.page(state.query);
      if (res.success) {
        state.opreateList = res.result;
      }
    }

    page()
    return {
        state,
        page
    }
  }
});
</script>



<style lang="less" scoped>
.box {
  margin: 0 20px;
}


</style>